import { Controller, Post, Body, Query, Get } from '@nestjs/common';
import { AuthService } from './auth.service';
import { CreateAuthDto } from './dto/create-auth.dto';
import { Public } from 'src/common/public.decorator';

@Controller('xc/api/auth')
export class AuthController {
  constructor(private readonly authService: AuthService) {}

  // 注册
  @Public()
  @Post('/register')
  register(@Body() registerData: CreateAuthDto) {
    return this.authService.register(registerData);
  }

  // 登录
  @Public()
  @Post('/login')
  login(@Query('username') username, @Query('password') password) {
    return this.authService.login({ username, password });
  }

  // 获取目录信息
  @Get('/getMenuPermission')
  getMenuPermission() {
    return this.authService.getMenuPermission();
  }
}
